package br.com.bibliotech.util;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

/**
 *
 * @author kamilla
 */
public class PersistenceFactory {
    
    private static EntityManagerFactory entityManagerFactory = null;
    private static EntityManager entityManager = null;

    public static EntityManager getEntityManager() {
        
        entityManagerFactory = Persistence.createEntityManagerFactory("Bibliotech2PU");
        entityManager = entityManagerFactory.createEntityManager();
        if (entityManager != null) {
            return entityManager;
        }
        return null;
        
    }
    
}
